package cn.xwlin.consts;

public class Result {
    private boolean success = true;
    private String reason;

    private String userId;
    private String data;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public static Result success() {
        Result result = new Result();
        result.setSuccess(true);
        return result;
    }

    public static Result success(String data) {
        Result result = new Result();
        result.setSuccess(true);
        result.setData(data);
        return result;
    }

    public static Result success(String userId, String data) {
        Result result = new Result();
        result.setSuccess(true);
        result.setUserId(userId);
        result.setData(data);
        return result;
    }

    public static Result failure(String reason) {
        Result result = new Result();
        result.setSuccess(false);
        result.setReason(reason);
        return result;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }
}
